package com.ruoyi.service.impl;

import com.ruoyi.entity.UserDTO;
import com.ruoyi.entity.UserOrderDto;
import com.ruoyi.mapper.UserOrderMapper;
import com.ruoyi.service.UserOrderService;
import io.jsonwebtoken.lang.Assert;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserOrderServiceImpl implements UserOrderService {

    @Resource
    private UserOrderMapper userOrderMapper;

    /**
     * 查询用户订单列表（支持按状态筛选）
     * @return 订单聚合列表
     */
    @Override
    public UserDTO getUserOrderList(Long userId) {
        if (userId == null) {
            throw new IllegalArgumentException("用户ID不能为空！");
        }

        // 调用Mapper查询
        return userOrderMapper.getUserOrderList(userId);
    }
}
